home *** CD-ROM | disk | FTP | other *** search
/ Celestin Apprentice 4 / Apprentice-Release4.iso / Utilities / Programming / EnterAct 3.5 / Drag_on Modules / hAWK programs / $StubFunctions < prev    next >
Encoding:
Text File  |  1992-10-30  |  811 b   |  43 lines  |  [TEXT/KEEN]

  1. #$StubFunctions
  2. #given protos such as
  3. #int f(long y);
  4. #long g(char x, Ptr z);
  5. #etc
  6. #produce
  7. #int f(long y)
  8. #    {
  9. #    
  10. #    }
  11. #
  12. #long g(char x, Ptr z)
  13. #    {
  14. #
  15. #    }
  16. #etc
  17.  
  18. #Typical run: select the prototypes in some text window; run this
  19. #program taking input from "Front text selection", with both
  20. #"Show stdout" and "Select stdout" checked; Copy the results shown
  21. #in stdout, and Paste them into your file.
  22.  
  23. #For simplicity, comments between protos not handled properly
  24.  
  25. /./    {
  26.     n = 0
  27.     x[0] = $0
  28.     while (x[n] != "" && !match(x[n], /;/))
  29.         {
  30.         getline x[++n]
  31.         }
  32.     gsub(/\(void\)/, "()");#optional, remove "void" from brackets
  33.     # paste in a starting comment
  34.     print "/* */"
  35.     for (i = 0; i <= n; ++i)
  36.         {
  37.         if (i == n)
  38.             gsub(/;/, "", x[n])#strip semicolon
  39.         print x[i]
  40.         }
  41.     print "\t{\n\t\n\t}\n" #print the function body
  42.     }
  43.